package com.aceitunaproject.gameclient;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * 
 * Mouse listener for the map area.
 * 
 * @author Federico Bergstein
 * 
 */
public class MapMouseListener implements MouseListener {

	private MapArea mapArea;

	public MapMouseListener(MapArea mapArea) {
		this.mapArea = mapArea;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseClicked(MouseEvent arg0) {
		EnumMouseButton mb = EnumMouseButton.LeftButton;

		switch (arg0.getButton()) {
		case MouseEvent.BUTTON1:
			mb = EnumMouseButton.LeftButton;
			break;

		case MouseEvent.BUTTON2:
			mb = EnumMouseButton.MiddleButton;
			break;

		case MouseEvent.BUTTON3:
			mb = EnumMouseButton.RightButton;
			break;

		default:
			break;
		}

		mapArea.mapClicked(mb, arg0.getPoint());

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
	 */
	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

}
